// import { connect } from "react-redux";

// const mapStateToProps = (state) => {
//   return {
//     count: state.count,
//   };
// };

// const mapDispatch = (dispatch) => {
//   return {
//     add() {
//       dispatch({
//         type: "add",
//       });
//     },
//   };
// };

import { useSelector, useDispatch } from "react-redux";
import { useEffect } from "react";

const Video = () => {
  const count = useSelector((state) => state.video.count);
  const ratedList = useSelector((state) => {
    return state.video.ratedList;
  });
  const dispatch = useDispatch();

  useEffect(() => {
    dispatch({ type: "takeload" });
    // eslint-disable-next-line
  }, [dispatch]);
  return (
    <>
      <div>这是视频页面</div>
      <button onClick={() => dispatch({ type: "takeminus" })}>-</button>
      <span>{count}</span>
      <button onClick={() => dispatch({ type: "takeadd" })}>+</button>

      <ul>
        {ratedList.map((item) => (
          <li key={item._id}>{item.title}</li>
        ))}
      </ul>
    </>
  );
};

// export default connect(mapStateToProps, mapDispatch)(Video);
export default Video;
